<template>
	<view class="topfix">
		<topfix>
			<template #l>
				<view class="topfix-l">
					<view class="cir"></view>
					<view>营业中</view>
				</view>
			</template>
			<template #c>
				<view class="topfix-c">
					<view>首页</view>
				</view>
			</template>
		</topfix>
	</view>
	<view class="sy-tit" @click="goshopuserinfo" v-if="shoperdata">
		<view class="t-l">
			<image :src="'http://127.0.0.1:3006'+shoperdata.img" mode="aspectFill"></image>
		</view>
		<view class="t-c">
			<view class="t-c-t">{{shoperdata.dname}}</view>
			<view class="t-c-b">点击查看店铺信息</view>
		</view>
		<view class="t-r">
			<view class="iconfont icon-jiantouyou"></view>
		</view>
	</view>
	<view class="redbox"></view>
	<view class="conbox">
		<view class="litsbox">
			<!-- 	<view class="listbox-item" v-for="i in listboxdata" :key="i.name" @click="gopages(i.path)">
				<view class="t" :style="{backgroundColor:i.color}">
					<view class="iconfont " :class="i.icon"></view>
				</view>
				<view class="b">{{i.name}}</view>
			</view> -->
			<view class="welcome">
					Welcome to ximo
			</view>
		</view>
		<!-- <view class="maidata"> -->

			<!-- 	<view class="t" @click="gojyshuju">
				<view class="t-l">
					<view class="line"></view>
					<view>经营数据</view>
				</view>
				<view class="t-r">
					更多
					<view class="iconfont icon-jiantouyou"></view>
				</view>
			</view> -->
			<!-- 		<view class="b">
				<view class="">
					 <view class="b-t red">1000</view>
					 <view class="b-b">今日订单量</view>
				</view>
				<view class="">
					 <view class="b-t red">1000</view>
					 <view class="b-b">今日营业额</view>
				</view>
				<view class="">
					 <view class="b-t red">1000</view>
					 <view class="b-b">今日客单价</view>
				</view>
				<view class="">
					 <view class="b-t">1000</view>
					 <view class="b-b">昨日订单量</view>
				</view>
				<view class="">
					 <view class="b-t">1000</view>
					 <view class="b-b">昨日营业额</view>
				</view>
				<view class="">
					 <view class="b-t">1000</view>
					 <view class="b-b">昨天客单价</view>
				</view>
			</view> -->
		<!-- </view> -->
		<!-- '		<view class="yingac">
			<view class="t">
				<view class="t-l">
					<view class="line"></view>
					<view>经营数据</view>
				</view>
				<view class="t-r">
					更多
					<view class="iconfont icon-jiantouyou"></view>
				</view>
			</view>
			<view class="b">
				<view class="">
					 <view class="b-t">20</view>
					 <view class="b-b">可报名活动</view>
				</view>
				<view class="">
					 <view class="b-t">6</view>
					 <view class="b-b">已报名活动</view>
				</view>
				<view class="">
					 <view class="b-t">20</view>
					 <view class="b-b">自建活动</view>
				</view>
			</view>
		</view>' -->
	</view>
</template>

<script setup>
	import {
		onLoad
	} from '@dcloudio/uni-app'
	import {
		ref
	} from 'vue'
	import topfix from '@/components/fixtop/fixtop.vue'
	import {
		getstatusheight,
		gettitleheight
	} from '@/utils/getsysteminfo.js'
	import {
		getshoperinfos
	} from '@/api/index.js'
	import userstore from '@/store/userinfo.js'
	const useuserstore = userstore()
	const heights = getstatusheight() + gettitleheight() + 'px'
	const shoperdata = ref()
	const listboxdata = [{
			icon: "icon-shangpin",
			name: "商店管理",
			path: `pages/productgl/productgl`,
			color: "#9f7efc"
		},
		{
			icon: "icon-caiwuguanli",
			name: "财务管理",
			path: "pages/pricegl/pricegl",
			color: "#ff6664"
		},
		{
			icon: "icon-daipingjia",
			name: "评价管理",
			path: "pages/pjgl/pjgl",
			color: "#fa916f"
		},
		{
			icon: "icon-tuangou",
			name: "团购优惠",
			path: "",
			color: "#fd9f09"
		}
	]
	onLoad(e => {
		getshoperinfodata()
	})
	const getshoperinfodata = async () => {
		const rudata = await getshoperinfos(useuserstore.userinfo.id)
		if (rudata.code == 200) {
			shoperdata.value = rudata.data
			useuserstore.shoperinfo = rudata.data

		}
	}
	const goopensatus = () => {
		uni.navigateTo({
			url: "/pages/openstatus/openstatus"
		})
	}
	const goshopuserinfo = () => {
		uni.navigateTo({
			url: `/pages/personinfo/personinfo?data=${JSON.stringify(shoperdata.value)}`
		})
	}
	const gojyshuju = () => {
		uni.navigateTo({
			url: "/pages/datacount/datacount"
		})
	}
	const gopages = (e) => {
		if (!e) {
			return uni.showToast({
				title: "尽情期待~",
				icon: "none"
			})
		}
		uni.navigateTo({
			url: `/${e}?data=${shoperdata.value.id}`
		})
	}
</script>

<style lang="scss" scoped>
	.welcome {
		height: 100%;
		width: 100%;
		display: flex;
		justify-content: center;
		align-items: center;
		font-size: 70rpx;
		font-weight: 700;

	}

	.yingac {
		height: 280rpx;
		background-color: #fff;
		border-radius: 15rpx;
		margin-top: 20rpx;
		padding: 20rpx;

		.t {
			height: 65rpx;
			font-size: 25rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.t-l {
				font-weight: 700;
				display: flex;
				align-items: center;

				.line {
					height: 25rpx;
					width: 7rpx;
					background-color: red;
					border-radius: 4rpx;
					margin-right: 10rpx;
				}
			}

			.t-r {
				display: flex;
				align-items: center;
				color: #7b7b7b;

				.iconfont {
					font-size: 25rpx
				}
			}
		}

		.b {
			height: calc(100% - 65rpx);
			display: grid;
			grid-template-columns: repeat(3, 1fr);
			justify-items: center;
			align-items: center;

			>view {
				display: flex;
				flex-direction: column;
				justify-content: center;
				align-items: center;
				gap: 15rpx;

				.red {
					color: red !important;
				}

				.b-t {}

				.b-b {
					font-size: 25rpx;
				}
			}
		}
	}

	.maidata {
		height: 420rpx;
		background-color: #fff;
		border-radius: 15rpx;
		margin-top: 20rpx;
		padding: 20rpx;

		.t {
			height: 65rpx;
			font-size: 25rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.t-l {
				font-weight: 700;
				display: flex;
				align-items: center;

				.line {
					height: 25rpx;
					width: 7rpx;
					background-color: red;
					border-radius: 4rpx;
					margin-right: 10rpx;
				}
			}

			.t-r {
				display: flex;
				align-items: center;
				color: #7b7b7b;

				.iconfont {
					font-size: 25rpx
				}
			}
		}

		.b {
			height: calc(100% - 65rpx);
			display: grid;
			grid-template-columns: repeat(3, 1fr);
			justify-items: center;
			align-items: center;

			>view {
				display: flex;
				flex-direction: column;
				justify-content: center;
				align-items: center;
				gap: 15rpx;

				.red {
					color: red !important;
				}

				.b-t {}

				.b-b {
					font-size: 25rpx;
				}
			}
		}
	}

	.conbox {
		width: 100%;
		height: calc(100vh - v-bind(heights) - 352rpx);
		background-color: #efefef;
		padding: 0 20rpx;
		float: right;
	}

	.topfix {
		background-color: #ff644d;
		color: #fff;
		font-size: 27rpx;
		border-bottom: 1rpx solid rgba(255, 255, 255, 0.3);

		.topfix-l {
			width: 100%;
			height: 100%;
			display: flex;
			align-items: center;
			padding-left: 20rpx;

			.cir {
				width: 20rpx;
				height: 20rpx;
				background-color: greenyellow;
				border-radius: 50%;
				margin-right: 5rpx;
			}
		}

		.topfix-c {
			width: 100%;
			height: 100%;
			display: flex;
			justify-content: center;
			align-items: center;
			font-size: 31rpx;
		}
	}

	.sy-tit {
		height: 250rpx;
		background-color: #ff644d;
		display: flex;
		color: #fff;

		.t-l {
			width: 25%;
			height: 100%;
			display: flex;
			justify-content: center;
			align-items: center;

			image {
				width: 120rpx;
				height: 120rpx;
				border-radius: 50%;
			}
		}

		.t-c {
			flex: 1;
			display: flex;
			flex-direction: column;
			justify-content: center;
			gap: 10rpx;

			.t-c-t {
				max-height: 75rpx;
				font-size: 29rpx;
				overflow: hidden;
				display: -webkit-box;
				-webkit-line-clamp: 2;
				-webkit-box-orient: vertical;
			}

			.t-c-b {
				font-size: 23rpx;
				color: #7b7b7b;
			}
		}

		.t-r {
			width: 25%;
			height: 100%;
			display: flex;
			justify-content: center;
			align-items: center;

			.iconfont {
				font-size: 28rpx;
			}
		}
	}

	.redbox {
		height: 100rpx;
		background-color: #ff644d;
	}

	.litsbox {
		height: 280rpx;
		background-color: #fff;
		border-radius: 15rpx;
		margin-top: -100rpx;
		z-index: 99;
		display: flex;
		box-shadow: 0 0 3rpx rgba(0, 0, 0, 0.1);

		.listbox-item {
			flex: 1;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			gap: 15rpx;

			.t {
				width: 90rpx;
				height: 90rpx;
				border-radius: 50%;
				background-color: #ff644d;
				display: flex;
				align-items: center;
				justify-content: center;
				box-shadow: 0 0 17rpx rgba(0, 0, 0, 0.3);

				.iconfont {
					color: #fff;
					font-size: 45rpx;
				}
			}

			.b {
				font-size: 25rpx;
				color: #000;

			}
		}
	}
</style>